<?php defined('_JEXEC') or die('Restricted access');?>


<?php

$scrl_border_rad = $params->get('scrl_border_rad');
$horizontal_height = $params->get('horizontal_height');
$vertical_width = $params->get('vertical_width');
$track_color = $params->get('track_color');
$drag_color = $params->get('drag_color');
$mod_id = $params->get('mod_id');
$jq_lib = $params->get('jq_lib');
$mod_height = $params->get('mod_height');
$mod_width = $params->get('mod_width');
$mouseWheelSpeed = $params->get('mouseWheelSpeed');
$arrowsSpeed = $params->get('arrowsSpeed');
$arrowsPosition = $params->get('arrowsPosition');
$arrowsPositionH = $params->get('arrowsPositionH');
$showArrows = $params->get('showArrows');
$showArrowsH = $params->get('showArrowsH');
$scrollHover = $params->get('scrollHover');
$scrollbarDistance = $params->get('scrollbarDistance');
$scrollbarDistanceH = $params->get('scrollbarDistanceH');
$hideFocus = $params->get('hideFocus');
$mod_corner_style = $params->get('mod_corner_style');
$jQborder = $params->get('jQborder');
$mod_bg_color = $params->get('mod_bg_color');
$mod_border_color = $params->get('mod_border_color');
$mod_border_width = $params->get('mod_border_width');
$mod_border_style = $params->get('mod_border_style');
$mod_border_padding = $params->get('mod_border_padding');
$mod_bg_color = $params->get('mod_bg_color');
$moduleclass_sfx = $params->get('moduleclass_sfx');
$showtitle_article = $params->get('showtitle_article', 0);
$read_more = $params->get('read_more', 1);
$Itemid = JRequest::getVar('Itemid', -1);
$url ="";

      $url = JRoute::_("index.php?option=com_content&amp;view=article&amp;id=".$item->id.":".$item->alias."&amp;catid=".$item->catid."&amp;Itemid=".$Itemid  , true);

?>


<link rel="stylesheet" type="text/css" media="screen, projection" href="modules/mod_rd_article_scrollbar/tmpl/css/rd_article_scrollbar.css" />

<style type="text/css">

#scroll-container<?php echo $mod_id; ?> {
	padding: <?php echo $mod_border_padding; ?>px;
	border: <?php echo $mod_border_width; ?>px <?php echo $mod_border_style; ?> #<?php echo $mod_border_color; ?>;
	background: #<?php echo $mod_bg_color; ?>;
}

.scroll-pane<?php echo $mod_id; ?>{
    height: <?php echo $mod_height; ?>px;
    overflow: auto;
    width: <?php echo $mod_width; ?>px;
}

#scroll-container<?php echo $mod_id; ?> .jspTrack{
	background: #<?php echo $track_color; ?>;
}

#scroll-container<?php echo $mod_id; ?> .jspDrag{
	background: #<?php echo $drag_color; ?>;
}

#scroll-container<?php echo $mod_id; ?> .jspHorizontalBar{
	height: <?php echo $horizontal_height; ?>px;
}

#scroll-container<?php echo $mod_id; ?> .jspVerticalBar{
	width: <?php echo $vertical_width; ?>px;
}

</style>

<?php if ($jq_lib == 1)	{
echo '<script type="text/javascript" src="modules/mod_rd_article_scrollbar/tmpl/js/jquery.min1.4.3.js"></script>';
}?>


<script type="text/javascript" src="modules/mod_rd_article_scrollbar/tmpl/js/jquery.mousewheel.js"></script>
<script type="text/javascript" src="modules/mod_rd_article_scrollbar/tmpl/js/jquery.jscrollpane.min.js"></script>
<script type="text/javascript" src="modules/mod_rd_article_scrollbar/tmpl/js/jquery.corner.js"></script>

<script type="text/javascript">
		var WheelSpeed<?php echo $mod_id; ?> = "<?php echo $mouseWheelSpeed; ?>";
		var ArrowSpeed<?php echo $mod_id; ?> = "<?php echo $arrowsSpeed; ?>";
		var ArrowPosition<?php echo $mod_id; ?> = "<?php echo $arrowsPosition; ?>";
		var ArrowPositionH<?php echo $mod_id; ?> = "<?php echo $arrowsPositionH; ?>";
		var showArrow<?php echo $mod_id; ?> = "<?php echo $showArrows; ?>";
		var scrollHover<?php echo $mod_id; ?> = "<?php echo $scrollHover; ?>";
		var hideF<?php echo $mod_id; ?> = "<?php echo $hideFocus; ?>";
		var scrollbarDistanceH<?php echo $mod_id; ?> = "<?php echo $scrollbarDistanceH; ?>";
	var scrl_border_rad<?php echo $mod_id; ?> = "<?php echo $scrl_border_rad; ?>";
		
		
		
		
		if (showArrow<?php echo $mod_id; ?> == "false"){showArrow<?php echo $mod_id; ?> = false;}
		
		jQuery.noConflict();
		
		if ("<?php echo $jQborder; ?>" == "yes") {
			jQuery("#scroll-container<?php echo $mod_id; ?>").corner("<?php echo $mod_corner_style; ?>");
		}
		
		
		jQuery(document).ready(function(){
				jQuery('.scroll-pane<?php echo $mod_id; ?>').jScrollPane(
					{
						showArrows: showArrow<?php echo $mod_id; ?>,
						hideFocus : hideF<?php echo $mod_id; ?>,
						arrowScrollOnHover: scrollHover<?php echo $mod_id; ?>,
						animateScroll: true,
						animateDuration: 2,
						arrowButtonSpeed : ArrowSpeed<?php echo $mod_id; ?>,
						mouseWheelSpeed : WheelSpeed<?php echo $mod_id; ?>,
						verticalArrowPositions: ArrowPosition<?php echo $mod_id; ?>,
						horizontalArrowPositions : ArrowPositionH<?php echo $mod_id; ?>,
						verticalGutter : <?php echo $scrollbarDistance; ?>,
						horizontalGutter : <?php echo $scrollbarDistance; ?>,
					}
				);
				
			if (scrl_border_rad<?php echo $mod_id; ?> > 1) {
				jQuery("#scroll-container<?php echo $mod_id; ?> .jspTrack").corner("<?php echo $scrl_border_rad; ?>px");
				jQuery("#scroll-container<?php echo $mod_id; ?> .jspDrag").corner("<?php echo $scrl_border_rad; ?>px");
			}
		});
</script>


<?php
  $config=&JFactory::getConfig();
  $title=$config->getValue("title");
?>  
		<table id="table-cont"border="0">
		<tbody>
		<tr>
		<td>
		<div id="main_container">
			<div id="scroll-container<?php echo $mod_id; ?>"> 								
				<?php if($showtitle_article == 0) { ?><h2><?php echo $item->title ; ?></h2><?php } ?>      
				<div class="scroll-pane<?php echo $mod_id; ?>">
					<div class="<?php echo $moduleclass_sfx; ?>">
						<?php echo $item->introtext; ?>
						<?php   if ($read_more == 0){ ?>
						  <a class='readmore' href='<?php echo $url; ?>'>
						  <?php echo JText::_("Readmore") ?>
						  </a>
						<?php  } ?>
					</div>
				</div>
			</div>
		</div>
		</td>
		</tr>
		</tbody>
		</table>
